package com.uwang.library;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

import com.sun.org.apache.xerces.internal.impl.xpath.regex.ParseException;
import com.uwang.library.model.BtnModel;
import com.uwang.library.service.BtnService;
import com.uwang.library.service.impl.BtnServiceImpl;

public class Test {

	public static void main(String[] args) {
		BtnService btnService = new BtnServiceImpl();
		int i = 1;
		List<BtnModel> btnList = (List<BtnModel>) btnService.findAllMenu(i);
			for (BtnModel btnModel : btnList) {
				System.out.println(dateToStamp(btnModel.getTerm().toString()));
			}
		
		
	}
	/* 
     * 将时间转换为时间戳
     */    
	public static String dateToStamp(String s) throws ParseException{
	        String res;
	        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
	        Date date = null;
			try {
				date = simpleDateFormat.parse(s);
			} catch (java.text.ParseException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
	        long ts = date.getTime();
	        res = String.valueOf(ts);
	        return res;
    }	
}
